/**
 * @author David Young
 */
package csab.core;

import org.newdawn.slick.Graphics;

/**
 * This is an Entity that is used to 
 * represent in-game items.
 * @author David Young
 */
public class Item extends Collidable {
	private int uses;
	public Item(String name, int uses) {
		super(name);
		init(uses);
	}
	
	private void init(int uses)
	{
		this.uses = uses;
	}
	
	/**
	 * Return the number of uses that
	 * this object has left.
	 * @return The number of uses left.
	 */
	public int getUses()
	{
		return uses;
	}
	
	/**
	 * Set the number of uses that this
	 * object has.
	 * @param uses The number of uses that
	 * this Item can have.
	 */
	public void setUses(int uses)
	{
		this.uses = uses;
	}
	
	/* (non-Javadoc)
	 * @see csab.core.Entity#destroy()
	 */
	@Override
	public void destroy() {
		// TODO Auto-generated method stub

	}

	/* (non-Javadoc)
	 * @see csab.core.Collidable#doCollide(csab.core.Collidable)
	 */
	@Override
	public void doCollide(Collidable obj) {
		// TODO Auto-generated method stub

	}

	/* (non-Javadoc)
	 * @see csab.core.Entity#draw(int, int, org.newdawn.slick.Graphics)
	 */
	@Override
	public void draw(int x, int y, Graphics g) {
		// TODO Auto-generated method stub

	}

	//TODO Implement this
	/**
	 * Perform this Item object's effect on
	 * the Sprite reference passed in.
	 * @param obj The Sprite reference which
	 * will receive the effect.
	 * @return true if the item is used
	 * successfully.
	 */
	public boolean useItem(Sprite obj) {
		if(this.uses <= 0)
			return false;
		else
		{
			this.uses++;
			return true;
		}
	}

}
